import { DefaultStage } from "../default-stage";
import { Debug } from "babylon-lib/gui/control/debug";
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
import { Helper } from "babylon-lib/tool/helper";
import { AbstractControl } from "babylon-lib/gui/control/abstract-control";
import { Model } from './model';
import { InputConfig } from "./input-config";
import { SoundManager } from './sound-manager';
import { ExplodeImprint } from "./landscape/explode-imprint";
import { CharacterManager } from "./character/character-manager";
import { Landscape } from "./landscape/landscape";
import { TargetManager } from "./target/target-manager";
import { ShellManager } from './weapon/shell-manager';


class GenerateComponent {
    public static initialize(stage: DefaultStage): void {
        this.testDebug(stage);
        SoundManager.initialize(stage);
        Model.initialize(stage);
        Landscape.initialize(stage);
        CharacterManager.initialize(stage);
        TargetManager.initialize(stage);
        InputConfig.initialize(stage);
        ExplodeImprint.initialize(stage);
        ShellManager.initialize(stage);
        this.initializeComponents(stage);
    }

    private static initializeComponents(stage: DefaultStage): void {
        const scene = stage.mainScene;
        Helper.setSceneMesh(scene, 'isPickable', false, [AbstractControl.namePostfix]);
        Helper.setSceneMesh(scene, 'checkCollisions', false);
    }

    private static testDebug(stage: DefaultStage): void {
        Debug.initialize(stage.mainScene, {
            scattered: true,
            offset: new Vector3(2, 0, 0),
            lockToCamera: true,
        });

        // AnimationFrame.request(() => {
        //     Debug.log('FPS:', FrameRate.fps);
        // }, 5000, 6000, {});
    }

}

export { GenerateComponent };
